/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import { Alert } from 'react-native';
import { unzip } from 'react-native-zip-archive';
import RNFS from 'react-native-fs';
const UnzipFile = async (zipFilePath: string, destPath: string): Promise<void> => {
    if ((await RNFS.exists(destPath))) {
        console.log("已经解压过了");
        return;
    }
    console.log('Begin to unzip');

    try {
        const resultPath = await unzip(zipFilePath, destPath);
        console.log(`Unzipped at ${resultPath}`);
        
    } catch (error) {
        console.error('Unzip failed', error);
        Alert.alert('下载报错','下载失败，请重试');
    }
};

export default UnzipFile;
